//
//  DiscoveryOneMenuView.m
//  LovingPartyBuilding
//
//  Created by 刘应平 on 17/5/1.
//  Copyright © 2017年 刘应平. All rights reserved.
//

#import "DiscoveryOneMenuView.h"

/**  130  */
@implementation DiscoveryOneMenuView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        CGFloat width1 = [UIScreen zj_screenWith] / 3;
        CGFloat width = (width1 - 60 * [UIScreen zj_screenHScale]) / 2;
        
        self.imageView = [UIImageView new];
        self.imageView.layer.cornerRadius = 30 * [UIScreen zj_screenHScale];
        self.imageView.layer.masksToBounds = YES;
        self.imageView.contentMode = UIViewContentModeCenter;
        [self addSubview:self.imageView];
        self.imageView.sd_layout
        .topSpaceToView(self,20 * [UIScreen zj_screenHScale])
        .leftSpaceToView(self,width)
        .heightIs(60 * [UIScreen zj_screenHScale])
        .widthIs(60 * [UIScreen zj_screenHScale]);
        
        
        self.label = [UILabel new];
        self.label.textColor = [UIColor textBlackColor];
        self.label.textAlignment = NSTextAlignmentCenter;
        self.label.font = [UIFont systemFontOfSize:15 * [UIScreen zj_textFontScale]];
        [self addSubview:self.label];
        self.label.sd_layout
        .centerXEqualToView(self)
        .widthIs(60)
        .heightIs(15 * [UIScreen zj_screenHScale])
        .topSpaceToView(self.imageView,10 * [UIScreen zj_screenHScale]);
        
        
        self.biaozhuImageView = [UIImageView new];
        
        self.biaozhuImageView.contentMode = UIViewContentModeLeft;
        self.biaozhuImageView.image = [UIImage imageNamed:@"icon_selectedshare"];
        [self addSubview:self.biaozhuImageView];
        self.biaozhuImageView.sd_layout
        .rightSpaceToView(self.label, 3 * [UIScreen zj_screenWScale])
        .widthIs(10 * [UIScreen zj_screenHScale])
        .heightIs(10 * [UIScreen zj_screenHScale])
        .topSpaceToView(self.imageView, 12.5 * [UIScreen zj_screenHScale]);
        
        
        
    }
    return self;
}

- (void)setTitleString:(NSString *)titleString{
    _titleString = titleString;
    CGFloat width = [CalculateLabelHeight CalculateLabelWidthWithString:titleString font:15 * [UIScreen zj_textFontScale] height:15 * [UIScreen zj_screenHScale]].width;
   self.label.sd_layout.widthIs(width);
    self.label.text = titleString;

}

- (void)setImageString:(NSString *)imageString{
    _imageString = imageString;
    self.imageView.image = [UIImage imageNamed:imageString];
}

- (void)setIsShow:(BOOL)isShow{
    _isShow = isShow;
    if (isShow) {
        self.biaozhuImageView.hidden = NO;
    }else{
        self.biaozhuImageView.hidden = YES;
    }
}

@end
